package com.haotian.redis.base;

import java.util.Set;

import com.haotian.redis.config._RedisConfig;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;

public class RedisClusterBase {

	protected JedisCluster cluster = null;

	/**
	 * 
	 * @param hostAndPort
	 *            {@link redis.clients.jedis.HostAndPort} 地址
	 * @param config
	 *            {@link com.haotian.redis.config._RedisConfig} 配置
	 * @param connectionTimeout
	 *            连接超时
	 * @param soTimeout
	 *            读取超时
	 * @param maxAttempts
	 *            重试次数
	 */
	protected RedisClusterBase(Set<HostAndPort> nodes, _RedisConfig config, int connectionTimeout, int soTimeout,
			int maxAttempts, String password) {
		if (null == password) {
			cluster = new JedisCluster(nodes, connectionTimeout, soTimeout, maxAttempts, config);
		} else {
			cluster = new JedisCluster(nodes, connectionTimeout, soTimeout, maxAttempts, password, config);
		}
	}
}
